Why is -[UISwitch superlayer] being called?
Posted
by Jonathan Sterling
on Stack Overflow
See other posts from Stack Overflow
or by Jonathan Sterling
Published on 2010-03-25T23:12:43Z
Indexed on
2010/03/26
3:03 UTC
Read the original article
Hit count: 606
I've got sort of a crazy thing going on where I have an NSProxy
subclass standing in for a UISwitch
. Messages sent to the proxy are forwarded to the switch. Please don't comment on whether or not this is a good design, because in context, it makes sense as an incredibly cool thing.
The dealio is that when I try to add this object as an accessory view to a UITableViewCell
, I get the following crash:
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[UISwitch superlayer]: unrecognized selector sent to instance 0x5889740'
Yes, I could just set the proxy's target as the accessory view, but then I would have to keep track of the proxy so that I could release it at the right time. So, what I really want is to be able to have the proxy retained by the table cell, and released when it is removed from the view just like a normal accessory view.
So, why is -[UISwitch superlayer]
(a method which does not exist) being called, and how do I save the world?
© Stack Overflow or respective owner